package com.example.lenovo_.myactivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.RelativeLayout;

import com.example.lenovo_.healthyangel.MyActivity;
import com.example.lenovo_.healthyangel.R;

/**
 * 启动Activity
 * 
 * @author JackalTsc
 * @time 2016年5月5日 上午11:30:15
 */
public class SplashActivity extends MyActivity {

	private RelativeLayout bgSplash;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		initView();

	}

	private void initView() {
		bgSplash = (RelativeLayout) findViewById(R.id.bg_splash);
		initAnim();
	}

	@Override
	protected int getLayoutActivity() {
		return R.layout.layout_activity_splash;
	}

	/**
	 * 初始化跳转
	 */
	private void initAnim() {

		Animation mAnimation = new AlphaAnimation(1.0f, 1.0f);
		mAnimation.setDuration(2500);

		mAnimation.setAnimationListener(new AnimationListener() {

			@Override
			public void onAnimationStart(Animation animation) {

			}

			@Override
			public void onAnimationRepeat(Animation animation) {

			}

			@Override
			public void onAnimationEnd(Animation animation) {
				startActivity(new Intent(SplashActivity.this, LoginActivity.class));
				SplashActivity.this.finish();
			}
		});

		bgSplash.setAnimation(mAnimation);

	}

}
